<template>
<!--  <TbTitle title="年检审核意见" />-->
<!--  <el-row style="width: 995px;margin-bottom: 10px;">-->
<!--    <el-col :span="24" style="text-align: right;">-->
<!--      <el-button type="primary" @click="signInfo">盖章</el-button>-->
<!--    </el-col>-->
<!--  </el-row>-->
  <div id="approvalInfo">
    <table border="0" class="m-table" style="width: 1000px;">
      <tr>
        <td rowspan="2">业务主管单位审核意见</td>
        <td colspan="2">登记管理机关审核意见</td>
      </tr>
      <tr>
        <td>审查</td>
        <td>审定</td>
      </tr>
      <tr>
        <td style="height: 276px; position: relative;">
          <div style="position: absolute; bottom: 0px; right: 0px; left: 0px;">
            <p>经办人： <span style="display: inline-block; margin-left: 150px;">(印
                鉴)</span></p>
            <p>年 月 日</p>
          </div>
        </td>
        <td style="height: 276px; position: relative;">
          <div style="position: absolute; bottom: 0px; right: 0px; left: 0px;">
            <p>承办人：</p>
            <p>负责人：</p>
            <p>年 月 日</p>
          </div>
        </td>
        <td style="height: 276px; position: relative;">
          <div style="position: absolute; bottom: 0px; right: 0px; left: 0px;">
            <p>(印 鉴) </p>
            <p>年 月 日</p>
          </div>
        </td>
      </tr>
      <tr>
        <td style="height: 276px; position: relative;">
          备注
        </td>
        <td colspan="2"></td>
      </tr>
    </table>
  </div>

<!--  <TbTitle title="送达记录" />-->
<!--  <div>-->
<!--    <table border="0" class="m-table">-->
<!--      <tr>-->
<!--        <td style="width:25%">呈报人</td>-->
<!--        <td style="width:25%"></td>-->
<!--        <td style="width:25%">联系电话</td>-->
<!--        <td></td>-->
<!--      </tr>-->
<!--      <tr>-->
<!--        <td>收件人</td>-->
<!--        <td></td>-->
<!--        <td>签收日期</td>-->
<!--        <td></td>-->
<!--      </tr>-->
<!--    </table>-->
<!--  </div>-->
</template>

<script setup lang="ts">

import { ref, inject, reactive } from 'vue'
import TbTitle from '@/views/yearCheck/components/TbTitle.vue'
import jsPDF from 'jspdf'
import html2canvas from 'html2canvas'
import md5 from 'js-md5'
import { ElLoading } from 'element-plus'
import { getSealSignPdf } from '@/views/yearCheck/ykb/otherApi'

let detailInfo = reactive({})
const { getDetailInfo } = inject('getDetailInfo')

getDetailInfo().then(res => {
  console.log(props.code)
  Object.assign(detailInfo, res.data)
})

const props = defineProps({
  code: {
    type: String,
    default: ''
  }
})
const postSeal = ref({
  base64Str: '',
  fileTitle: '年检审核意见',
  orgId: '11500235756206471Y',
  orgName: '云阳县民政局',
  personContact: '18996663938',
  sealPassword: '110551201',
  fileType: 'png',
  fileWidth: undefined,
  fileHeight: undefined,
  sealPositionSize: '1',
  purposeText: '社会组织年检盖章',
  fileSubject: '社会组织年检盖章封面',
  expireTime: '',
  endTime: '',
  page: '0',
  offsetX: '0.7',
  offsetY: '0.6'
})
function signInfo(){
  let content = document.getElementById('approvalInfo')
  const pdf = new jsPDF()
  html2canvas(content, { scale: 1, fontScale: 1 }).then(canvas => {
    // 将canvas转换为图片
    const imgData = canvas.toDataURL('image/png')
    console.log(imgData)
    const loading = ElLoading.service({
      lock: true,
      text: '请稍后...',
      background: 'rgba(0, 0, 0, 0.6)'
    })
    postSeal.value.base64Str = imgData
    getSealSignPdf(postSeal.value).then(response => {
      loading.close()
      console.log(response.msg)
      getSealImage()
    }).catch((error) => {
      loading.close()
    })
  })
}

function getSealImage(){

}
function getSealInfo(){

}
</script>
<style lang="scss" scoped>
.msg-tip {
  padding: 20px 0;
  color: #000;

  font-family: '微软雅黑';
}
</style>
